package jsyf.oa.dao.email;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import jsyf.com.dao.BaseJdbcDao;
import jsyf.oa.entity.email.EmailMainEntity;
import jsyf.oa.entity.email.WreportReceiverCopiersEntity;
import jsyf.oa.idao.BaseDao;
import jsyf.oa.ientity.IBaseEntity;
import org.springframework.stereotype.Repository;

import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * Created by LT on 2018/6/7.
 */
@Repository
public class WreportReceiverCopiersDao extends BaseDao {

    public WreportReceiverCopiersDao() {
        super.iBaseEntity = new WreportReceiverCopiersEntity();
    }

    @Override
    public IBaseEntity convertJson2Entity(JSONObject json) {
        return JSON.toJavaObject(json, WreportReceiverCopiersEntity.class);
    }

    public List<JSONObject> getJSONListByCondition(String condition, Object[] params) {
        StringBuffer sql = new StringBuffer();
        sql.append(" SELECT\n" +
                "\tT_WRT_RECEIVER_COPIERS.W_ID AS wId,\n" +
                "\tT_WRT_RECEIVER_COPIERS.TYPE AS type,\n" +
                "\tT_WRT_RECEIVER_COPIERS.ID AS id,\n" +
                "\tT_WRT_RECEIVER_COPIERS.REPORT_DATE AS reportDate,\n" +
                "\tT_WRT_RECEIVER_COPIERS.SENDER_USER_ID AS senderUserId,\n" +
                "\tT_WRT_RECEIVER_COPIERS.USER_NAME AS userName,\n" +
                "\tT_WRT_RECEIVER_COPIERS.USER_ID AS userId\n" +
                "FROM\n" +
                "\tT_WRT_RECEIVER_COPIERS\n" +
                "LEFT JOIN t_sys_user ON T_WRT_RECEIVER_COPIERS.USER_ID=t_sys_user.ID\n" +
                "WHERE\n" +
                "\t1 = 1\n" +
                "AND t_sys_user.JOB_STATE!=1 \n");
        sql.append(condition);
        List<JSONObject> jsonList = super.queryForJsonList(sql.toString(), params);

        return jsonList;
    }
}
